🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / database / src / commonMain / kotlin / org / meshtastic / core / database / di / CoreDatabaseModule.kt
Displaying Raw • Download
core/database/src/commonMain/kotlin/org/meshtastic/core/database/di/CoreDatabaseModule.kt 41414f832f938b655c97bc07509bc140ea16e2a3 (41414f83) Text, 1.85 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.database.di
Tff7b72import T7ee787org.koin.core.annotation.ComponentScan
Tff7b72import T7ee787org.koin.core.annotation.Factory
Tff7b72import T7ee787org.koin.core.annotation.Module
Tff7b72import T7ee787org.koin.core.annotation.Single
Tff7b72import T7ee787org.meshtastic.core.database.DatabaseProvider
Tff7b72import T7ee787org.meshtastic.core.database.createDatabaseDataStore
Tff7b72import T7ee787org.meshtastic.core.database.dao.DiscoveryDao
Tff7b72import T7ee787org.meshtastic.core.database.dao.SwitchingDiscoveryDao
Tf0883e@Module
Tf0883e@ComponentScanTb4b4b4(Ta5d6ff"Ta5d6fforg.meshtastic.core.databaseTa5d6ff"Tb4b4b4)
Tff7b72class T56d364CoreDatabaseModule Tb4b4b4{
Tf0883e@Single
Tff7b72fun Td2a8ffprovideDatabaseDataStoreTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3DatabaseDataStore Tff7b72=
Te6edf3createDatabaseDataStoreTb4b4b4(Ta5d6ff"Ta5d6ffdb-manager-prefsTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3asDatabaseDataStoreTb4b4b4(Tb4b4b4)
T8b949e/**
* Long-lived consumers (discovery ViewModels, the scan engine) hold this DAO across device/DB switches, so hand
* them the switch-aware delegate — never a DAO pinned to the injection-time `currentDb.value`, which would keep
* reading a stale DB and crash once a cross-transport merge retires it. See [SwitchingDiscoveryDao].
*/
Tf0883e@Factory
Tff7b72fun Td2a8ffprovideDiscoveryDaoTb4b4b4(Te6edf3databaseProviderTb4b4b4: Te6edf3DatabaseProviderTb4b4b4)Tb4b4b4: Te6edf3DiscoveryDao Tff7b72= Te6edf3SwitchingDiscoveryDaoTb4b4b4(Te6edf3databaseProviderTb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s